package com.woniuxy.springmvcannotation;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author linke
 * @version 1.0
 * @className: MyController
 * @description: 控制器
 * @date 2021/11/13 16:57
 * @Controller 将控制器交给spring容器管理 表示要跳页面
 * @RequestMapping 定义页面请求路径，与执行该路径请求的 方法之间的映射关系
 */
@RequestMapping("/my")
@Controller
public class MyController {

    /**
     * 登录方法
     * @param request 请求对象
     * @param response 响应对象
     * @return
     */
    @RequestMapping("/login")
    public ModelAndView login(HttpServletRequest request, HttpServletResponse response){
        String loginName = request.getParameter("loginName");
        String password = request.getParameter("password");

        System.out.println(loginName);
        System.out.println(password);


        ModelAndView mv = new ModelAndView();
        mv.setViewName("sysmag/main");
        return mv;
    }
}
